package com.richinfo.consumer.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.richinfo.consumer.entity.User;
import com.richinfo.consumer.service.HelloService;
import com.richinfo.consumer.service.RefactorHelloService;

/**
* Created by WangXJ
* 2018-11-05 14:48
*/
@RestController
public class ConsumerController {
	
	@Resource
	private HelloService helloService;
	@Resource
	private RefactorHelloService refactorHelloService;
	
	@GetMapping("/feign-consumer")
	public String helloConsumer() {
		return helloService.hello();
	}
	
	@GetMapping("/feign-consumer2")
	public String helloConsumer2() {
		StringBuilder sb = new StringBuilder();
		sb.append(helloService.hello()).append("\n");
		sb.append(helloService.hello("WXJ")).append("\n");
		sb.append(helloService.hello("WXJ", 24)).append("\n");
		sb.append(helloService.hello(new User("WXJ", 24))).append("\n");
		return sb.toString();
	}
	
	@GetMapping("/feign-consumer3")
	public String helloConsumer3() {
		StringBuilder sb = new StringBuilder();
		sb.append(refactorHelloService.hello("J"));
		sb.append(refactorHelloService.hello(new com.richinfo.api.entity.User("J",24)));
		sb.append(refactorHelloService.hello("J",24));
		return sb.toString();
	}
}
